<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';

$db = new DB();

$today = mktime(0,0,0,date('m',time()),date('d',time()),date('Y',time()));//今天0点
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;//当前页码
$pageSize = 20;//每页条数

//查询总记录数
$total_sql = 'select id from users where lastlogin>'.$today;
$total = $db->query($total_sql)->getCount();

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/log/login_today.php');

//查询当前页记录
$login_today_sql = 'select username,lastlogin,lastip,updated from users where lastlogin>'.$today.' order by updated asc limit '.(($page-1)*$pageSize).','.$pageSize;
$login_today_rs = $db->query($login_today_sql)->getAll();

require template('admin/log/login_today');